#include "stdafx.h"
#include "standard/CThrowException.h"

CThrowException::CThrowException()
{
    this->m_message.clear() ;
    this->m_file     = 0;
    this->m_line     = 0;
    this->m_code     = 0;
}

CThrowException::CThrowException(std::string message)
{
    this->m_message  = message;
    this->m_file     = 0;
    this->m_line     = 0;
    this->m_code     = 0;
}

CThrowException::CThrowException(std::string message, int num, ...)
{
    va_list vp;
    va_start(vp, num);
    
   this->m_message = message;
    this->m_file     = 0;
    this->m_line     = 0;
    this->m_code     = 0;
    
    if (num > 0)
    {
        switch (num)
        {
            case 1: 
                this->m_file = va_arg(vp, const char*);
                break;
            case 2: 
                this->m_file = va_arg(vp, const char*);
                this->m_line = va_arg(vp, int);
                break;
            case 3:
                this->m_file = va_arg(vp, const char*);
                this->m_line = va_arg(vp, int);
                this->m_code = va_arg(vp, int);
                break;
            default:  
                this->m_file = va_arg(vp, const char*);
                this->m_line = va_arg(vp, int);
                this->m_code = va_arg(vp, int);
                break;  
        }
    }   
    
    va_end(vp);
}

std::string CThrowException::getMessage()
{
    return this->m_message ;
}

int CThrowException::getLine()
{
    return this->m_line;
}

const char* CThrowException::getFile()
{
    return this->m_file;
}

int CThrowException::getCode()
{
    return this->m_code;
}

CThrowException::~CThrowException()
{

}

